{* $Id: page.html 22502 2013-04-08 07:48:01Z qianym $ *}
{if isset($pager)}
<div class="page-box pages {$float}">
  {if $pager->getPage() > 1}
    <a href="/{$pager->link($pager->prev())}" data-page-no="{$pager->prev()}" class="page-contro active">&lt;</a>
  {else}
    <a href="javascript:void(0);" class="page-contro">&lt;</a>
  {/if}
  {foreach from=$pager->getPagesArray(3) item=v}
    {if $pager->getPage() == $v}
    <a href="javascript:void(0);" class="curr" data-page-no="{$v}">{$v}</a>
    {else}
    <a href="/{$pager->link($v)}" data-page-no="{$v}">{$v}</a>
    {/if}
  {/foreach}
  {if ($pager->getPage() + 1 < $pager->end() && $pager->getPage() != 1) ||  ($pager->getPage() == 1 && $pager->end() > 3)}
  <a href="/{$pager->link($pager->end())}" data-page-no="{$pager->end()}"><em>...</em>{$pager->end()}</a>
  {/if}
  {* @todo @chess 2015-01-15 12:25:08 *}
  <span class="page-select">
    <form action="" id="js_pageForm" method="get">
    <input type="text" name="page_no"/>
    </form>
  </span>
  {if $pager->getPage() < $pager->end()}
    <a href="/{$pager->link($pager->next())}" data-page-no="{$pager->next()}" class="page-contro active">&gt;</a> 
  {else}
    <a href="javascript:void(0);" data-page-no="{$pager->next()}" class="page-contro">&gt;</a> 
  {/if}
</div>
<script>
  window.onload = function(){
    var pageForm = document.getElementById('js_pageForm');
    var param = location.search.toString().substr(1);
    var paramArr = param.split('&');
    var paramArrLen = paramArr.length;
    if (paramArrLen > 0) {
      for (var i = 0; i < paramArrLen; i++) {
        var currArr = paramArr[i].toString().split('=');
        if (currArr[0] != 'page_no') {
          var newNode = document.createElement("input");
          newNode.type = 'hidden';
          newNode.name = currArr[0];
          newNode.value = currArr[1];
          pageForm.appendChild(newNode);
          //$('#js_pageForm').prepend('<input type="hidden" name="'+currArr[0]+'" value="'+currArr[1]+'"/>');
        }
      }
    }
  }
</script>
{/if}